<?php
header('Content-Type: application/json');

// 数据库连接配置
include 'config.php'; 

// 获取GET请求的参数
$qq = $_GET['qq'] ?? null;

if (!$qq) {
    echo json_encode(['code' => 400, 'message' => '缺少参数 qq']);
    exit;
}

// 查询授权信息
$sql = "SELECT qq, lxqq, vip_time FROM sq WHERE qq = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $qq);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows > 0) {
    $data = $result->fetch_assoc();
    echo json_encode(['code' => 200, 'data' => $data]);
} else {
    echo json_encode(['code' => 404, 'message' => '未找到授权信息']);
}

$stmt->close();
$conn->close();
?>
